package se.hb.eme;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class ApiCallerView extends ListActivity {

	@Override
	public void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);
		//Should write a list of Api-calls to the user that he/she could choose between.
		//First just searchServices

		String[] list_items = getResources().getStringArray(R.array.values_ApiCallerView);
		setListAdapter(new ArrayAdapter<String>(this, R.layout.apiview, list_items));
		
		ListView lv = getListView();
		lv.setTextFilterEnabled(true);
		lv.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// When clicked, show a toast with the TextView text

				
				Toast.makeText(getApplicationContext(),
						((TextView) view).getText(), Toast.LENGTH_SHORT).show();

			
			}
		});
	
	}
/*
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
	}
*/
}
